<?php
namespace app\index\controller;
use think\Controller;
class Jadax extends Controller{

	public function  jiazai(){
         $home_id=db('Home');
         $home_user=db('HomeUser');
        $list=$home_id->order('id asc')->paginate(50);
            $html='';
        foreach($list as $val){
        	$id=$val['id'];
        	$count=$home_user->where('home_id='.$val['id'])->count();
        	$val['create_time']=date('Y-m-d H:i',$val['create_time']);
        	$html.="
                <tr>
                
            	<td>{$val['id']}</td>
    				<td>{$val['home_name']}</td>
    				<td data-breakpoints='xs'>{$val['create_time']}</font></td>
    				<td>{$val['role_user_id']}</td>
    				<td>{$val['createid']}</td>
    				<td>{$count}</td>
                    <td><a href='homeuser?id=$id'>查看</a></td>
    			</tr>";
		}
      
     return $html;
    }
    function homeuser(){
       $id=input('post.id');  
         $home_user=db('HomeUser');
        
        $list=$home_user->alias('a')->field('a.*,b.nickname')->join('app_users b','b.id=a.user_id')->where('a.home_id='.$id)->paginate(50);
    
            $html='';
        foreach($list as $val){
          
            $html.="
                <tr>
                    <td>{$val['id']}</td>
                    <td>{$val['user_id']}</td>
                    <td>{$val['nickname']}</td>
                   
                </tr>";
            }

            return $html;
    }
   

}